<?php
/**
 *
 *
 * @package php.ui.winbinder
 */

/**
 * WBFont 클래스 
 *
 * @package php.ui.winbinder
 */ 

class WBFont extends PObject { 
	private $_name		= '';
	private $_height	= '';
	private $_color		= '';
	private $_flags		= '';

	public function __construct($name, $height, $color = BLACK, $flags = 'normal') { 
		$this->_name	= $name;
		$this->_height	= $height;
		$this->_color	= $color;
		$this->_flags	= wbconstant($flags, 'FTA');

		$this->create();
	}

	/** 
	 * 폰트 생성 
	 *
	 */
	public function create() { 
		$this->setInstance(wb_create_font($this->_name, $this->_height, $this->_color, $this->_flags));
	}

	/** 
	 * 폰트 instance 설정 
	 *
	 */
	public function setInstance($instance) { 
		$this->_instance = $instance;
	}

	/**
	 * 폰트 instance 얻어오기 
	 *
	 * @return resource 
	 */
	public function getInstance() { 
		return $this->_instance;
	}

	/**
	 * 폰트 메모리 해제 
	 *
	 */
	public function destroy() { 
		return wb_destroy_font($this->getInstance());
	}

	/** 
	 * 소멸자 지정, 자동으로 메모리 해제 
	 *
	 */
	public function __destruct() { 
		if ($this->getInstance()) {
			$this->destroy();
		}
	}
}
?>